﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

#nullable disable

namespace T4.Console.Db.Models
{
    [Table("Sys_User")]
    [Index(nameof(UserName), Name = "AK_KEY_2_Sys_User", IsUnique = true)]
    [Index(nameof(UserName), Name = "Index_UserName")]
    public partial class Sys_User
    {
        public Sys_User()
        {
            Blog_Collects = new HashSet<Blog_Collect>();
            Blog_FocusFocusOns = new HashSet<Blog_Focus>();
            Blog_FocusPeople = new HashSet<Blog_Focus>();
            Blog_Infos = new HashSet<Blog_Info>();
            Blog_PersonCategories = new HashSet<Blog_PersonCategory>();
            Blog_PersonLabels = new HashSet<Blog_PersonLabel>();
            Sys_UserRoles = new HashSet<Sys_UserRole>();
            Sys_User_RefreshTokens = new HashSet<Sys_User_RefreshToken>();
        }

        [Key]
        [StringLength(36)]
        public string Id { get; set; }
        public int Category { get; set; }
        [Required]
        [StringLength(50)]
        public string UserName { get; set; }
        [StringLength(50)]
        public string Name { get; set; }
        public int? Sex { get; set; }
        [Column(TypeName = "date")]
        public DateTime? Birthdate { get; set; }
        [StringLength(50)]
        public string Nickname { get; set; }
        [StringLength(20)]
        public string MobileNo { get; set; }
        [StringLength(50)]
        public string Email { get; set; }
        [StringLength(200)]
        public string PersonalImage { get; set; }
        [StringLength(50)]
        public string Password { get; set; }
        [StringLength(100)]
        public string Remark { get; set; }
        public bool IsActive { get; set; }
        public int Sort { get; set; }
        [StringLength(36)]
        public string CreatedBy { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? CreatedTime { get; set; }
        [StringLength(36)]
        public string LastModifiedBy { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? LastModifiedTime { get; set; }

        [InverseProperty("User")]
        public virtual Blog_Personal Blog_Personal { get; set; }
        [InverseProperty(nameof(Blog_Collect.Collect))]
        public virtual ICollection<Blog_Collect> Blog_Collects { get; set; }
        [InverseProperty(nameof(Blog_Focus.FocusOn))]
        public virtual ICollection<Blog_Focus> Blog_FocusFocusOns { get; set; }
        [InverseProperty(nameof(Blog_Focus.Person))]
        public virtual ICollection<Blog_Focus> Blog_FocusPeople { get; set; }
        [InverseProperty(nameof(Blog_Info.AuthorNavigation))]
        public virtual ICollection<Blog_Info> Blog_Infos { get; set; }
        [InverseProperty(nameof(Blog_PersonCategory.User))]
        public virtual ICollection<Blog_PersonCategory> Blog_PersonCategories { get; set; }
        [InverseProperty(nameof(Blog_PersonLabel.User))]
        public virtual ICollection<Blog_PersonLabel> Blog_PersonLabels { get; set; }
        [InverseProperty(nameof(Sys_UserRole.User))]
        public virtual ICollection<Sys_UserRole> Sys_UserRoles { get; set; }
        [InverseProperty(nameof(Sys_User_RefreshToken.User))]
        public virtual ICollection<Sys_User_RefreshToken> Sys_User_RefreshTokens { get; set; }
    }
}
